<template>
	<view class="pulish">
		<view class="list flex-between" v-for="(item,index) in list" :key="index">
			<view class="left">
				<view class="title flex">
					{{item.from_city}}
					<image src="/static/arrow-right.png" mode="widthFix"></image>
					{{item.to_city}}
				</view>
				<view class="p">时间：{{item.begin_time}}</view>
				<view class="p">订座/余座：{{item.seat - item.remain_seat}}人/{{item.seat}}人</view>
			</view>
			<view class="right" v-if="item.status == 2">
				<text class="p">进行中</text>
				<navigator url="/pages/self/chezhuTrip" hover-class="none" class="flex-center">查看</navigator>
			</view>
			<view class="right" v-else>
				<text class="p">已完成</text>
				<navigator url="/pages/self/modifyPublish" hover-class="none" class="flex-center">编辑</navigator>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				now_page:1,
				has_more:false,
				list:[]
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			getList(){
				this.$https.get('car/doneList',{
					page:this.now_page,
					page_size:10
				}).then(res=>{
					console.log(res)
					this.list = res.list;
					this.has_more = res.has_more;
				})
			}
		},
		onReachBottom(){
			if(this.has_more){
				this.now_page++;
				this.getList()
			}
		}
	}
</script>

<style lang="less">
	@color: #4CD964;
	page{
		background: #f2f3f4;
	}
	.pulish{
		padding: 24rpx 0;
		.list{
			background: white;
			padding: 24rpx;
			margin-bottom: 1px;
			.title{
				font-size: 34rpx;
				margin-bottom: 10rpx;
				font-weight: bold;
				image{
					width: 50rpx;
					height: auto;
				}
			}
			.p{
				font-size: 28rpx;
				color:#999;
				line-height: 1.7;
			}
			.right{
				text-align: right;
			}
			navigator{
				font-size: 28rpx;
				background: @color;
				color:white;
				width: 100rpx;
				height: 60rpx;
				border-radius: 8rpx;
				margin-top: 10rpx;
			}
		}
	}
</style>
